package com.charles.video.system.controller;

import com.charles.video.common.core.controller.BaseController;
import com.charles.video.common.core.responseDomain.AjaxResult;
import com.charles.video.system.mapper.DailyRequestRecordMapper;
import com.charles.video.system.mapper.WeeklyVideoViewRecordMapper;
import com.charles.video.system.vo.DailyRequestVo;
import com.charles.video.system.vo.ViewDataVo;
import com.charles.video.system.vo.WeeklyTypeRecordVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Charles-H
 * 
 * 数据控制层
 */
@RestController
@RequestMapping("/data")
public class DataController extends BaseController {
    
    @Resource
    private DailyRequestRecordMapper dailyRequestRecordMapper;
    
    @Resource
    private WeeklyVideoViewRecordMapper weeklyVideoViewRecordMapper;
    
    @GetMapping("/getRecordData")
    public AjaxResult getRecordData() {
        List<DailyRequestVo> dailyRequestRecords = dailyRequestRecordMapper.queryWeekData();
        List<WeeklyTypeRecordVo> weeklyTypeRecordVos = weeklyVideoViewRecordMapper.queryWeekData();

        return AjaxResult.success(new ViewDataVo(dailyRequestRecords, weeklyTypeRecordVos));
    }
    
}
